package it.antonio.ilpizze.func;


public abstract class Order<T> {
	public static final int EQUALS = 111;
	public static final int FIRST_GREATER = 222;
	public static final int FIRST_LESSER = 333;
	public static final int SECOND_GREATER = FIRST_LESSER;
	public static final int SECOND_LESSER = FIRST_GREATER;
	
	public abstract int order(T e1, T e2);
	
	public Order<T> reverse(){
		return new Order<T>() {
			@Override
			public int order(T e1, T e2) {
				int order = Order.this.order(e1, e2);
				if(order == EQUALS) return order;
				if(order == FIRST_GREATER) return FIRST_LESSER;
				if(order == FIRST_LESSER) return FIRST_GREATER;
				return order ;
			}
		};
	}
}
